// 引入 vue
import Vue from "vue";
// 引入 vuex
import Vuex from "vuex";
// 创建vuex实例
export default () => {
  return new Vuex.Store({
    state: {
      language: "en",
    },
    mutations: {
      setLanguage(state, data) {
        state.language = data;
        if (process.client) {
          localStorage.setItem("language", data);
        }
      },
    },
    actions: {},
    getters: {
      language: (state) => state.language,
    },
  });
};
